package com.tanhua.dubbo.api.db;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.tanhua.domain.db.SoultestQuestion;
import com.tanhua.dubbo.api.db.SoultestQuestionApi;
import com.tanhua.dubbo.mapper.SoultestPaperMapper;
import com.tanhua.dubbo.mapper.SoultestQuestionMapper;
import org.apache.dubbo.config.annotation.Service;
import org.springframework.beans.factory.annotation.Autowired;

import java.util.List;

@Service
public class SoultestQuestionApiImpl implements SoultestQuestionApi {

    @Autowired
    private SoultestQuestionMapper soultestQuestionMapper;

    @Override
    public List<SoultestQuestion> getQuestions(Long paperId) {
        QueryWrapper<SoultestQuestion> queryWrapper=new QueryWrapper<>();
        queryWrapper.eq("paper_id",paperId);
        return  soultestQuestionMapper.selectList(queryWrapper);
    }

    /**
     * 根据问题id查询问题表
     * @param questionId
     * @return
     */
    @Override
    public SoultestQuestion queryQuestionById(Long questionId) {
        QueryWrapper<SoultestQuestion> queryWrapper=new QueryWrapper<>();
        queryWrapper.eq("id",questionId);
        return soultestQuestionMapper.selectOne(queryWrapper);
    }
}
